var myapp=angular.module('myApp', []).
  config(['$routeProvider', function($routeProvider) {
  $routeProvider.
      when('/', {templateUrl: 'out_ngrepeat_ajs.html', controller: outrptctrl}).
	  when('/statemnt/', {templateUrl: 'out_ngrepeat_ajs.html', controller: outrptctrl}). 
	   otherwise({redirectTo: '/'});
}]);



myapp.filter('startingFrom', function() 
    {
            return function(input, start) 
            {
                start = +start; //parse to int
                return input.slice(start);
            };
    });
    
  $scope.outstandingmast = {};
  $scope.loading = true;


function outrptctrl($scope, $http,$window) {
     $http.get('outstandingdata.php').success(function(data,status) 
  {
    $scope.currentPage = 0;
    $scope.pageSize = 75;
    $scope.outstandingmast = data;
  //  $window.alert("Total Customer  "+data.length);
   
   $scope.loading = false;
  }).error(function(data, status) {
      $scope.status = 'Error getting Outstanding ! ' + data;
      $scope.loading = false;
    });
    
    
    $scope.numberOfPages=function()
    {
        return Math.ceil($scope.data.length / $scope.pageSize);                
    };
	
	$scope.viewstmnt = function(user)
	{
	$window.alert( 'View statement for ' + user.custid +'  '+ user.custdesc);
	};
	
	
	$scope.ShowOutstandingReport = function(fromdate,user)
	{
	$window.alert( 'View ledger for ' + user.custid +'  '+ user.custdesc);
	};
   }
   
 